package com.ljx.lambda.lambda02;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.function.Function;
import java.util.function.Supplier;

/**
 * @author LJX
 * @Description: 实例方法引用 inst::instMethod
 * (args)->inst.instMethod(args)
 * @Date: 2022/11/4 10:18
 * @Version 1.0
 */
public class InstTest01 {
	public static void main(String[] args) {
		// 无参是应用Supplier供给型函数式接口
		Ljx ljx = new Ljx("李吉祥","12");
		Supplier<String> supplier1=()->ljx.getName();

		//方法的引用中，我们可以使用实例方法引用，使语法更简洁
		Supplier<String> supplier2=ljx::getAge;
		String s = supplier2.get();
		System.out.println(s);
	}
}

@Data
@AllArgsConstructor
@NoArgsConstructor
class Ljx{
	private String name;
	private String  age;

}